package scan;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.HashMap;

/**
 * 
 * @author Burn
 * 
 */
public class FileTypes {

	private URL fileTypesURL;
	private HashMap<String, String> htable;
	private String[] oneRow;

	public FileTypes() {

		fileTypesURL = FileTypes.class.getResource("FileTypes.txt");

		if (fileTypesURL != null) {
			htable = new HashMap<String, String>();

			try {
				BufferedReader in = new BufferedReader(new InputStreamReader(
						fileTypesURL.openStream()));

				String inputLine;
				oneRow = new String[2];

				while ((inputLine = in.readLine()) != null) {
					oneRow = inputLine.split("\\t");
					htable.put(oneRow[0], oneRow[1]);
				}

				in.close();
			} catch (IOException e) {
				System.err.println("Error : " + e);
			}
		} else {
			System.err.println("Couldn't find file: FileTypes.txt");
		}
	}

	public HashMap<String, String> getHashMap() {
		return htable;
	}

}
